define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'data.user_lottery_log/index',
        add_url: 'data.user_lottery_log/add',
        edit_url: 'data.user_lottery_log/edit',
        delete_url: 'data.user_lottery_log/delete',
        export_url: 'data.user_lottery_log/export',
        modify_url: 'data.user_lottery_log/modify',
        prize_url: 'data.user_lottery_log/prize',
        info_url: 'data.user_lottery_log/info',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar:['refresh'],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'user.nickname', title: '用户',search:false},
                    {field: 'store.store_name', title: '商家',search:false},
                    {field: 'award', title: '中奖内容',search:false},
                    {field: 'create_time', title: '中奖时间',search:'range'},
                    {width: 250, title: '操作', templet: ea.table.tool,
                        operat: [
                            [{
                                text: '用户信息',
                                url: init.info_url,
                                method: 'open',
                                auth: 'info',
                                class: 'layui-btn layui-btn-xs layui-btn-normal',
                            },{
                                text: '兑奖',
                                url: init.prize_url,
                                method: 'open',
                                auth: 'edit',
                                class: 'layui-btn layui-btn-xs layui-btn-danger',
                            }]]},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
        prize:function (){
            ea.listen();
        },
        info:function () {
            ea.listen();
        }
    };
    return Controller;
});